[#ftl]
[@define "agile.dijit.ProgressBar" "agile._Component,agile._Resizable"]
	category:"ProgressBar Component"		
	,widgetName:"ProgressBar"
	[#assign templateString][#compress]
		<div class='agileComponent agileProgressBar'>
 			<div data-dojo-attach-point="delegate" data-dojo-type="dijit.ProgressBar" data-dojo-props='indeterminate:{parameters.indeterminate}' style="height:100%!important;width:{style.width}"></div>
		</div>
	[/#compress][/#assign]
	,templateString:"${templateString?js_string}"
	,resizeAxis:"x"	
	,styleConstraints:agile.delegate(agile._Component.prototype.styleConstraints,{
		"height":{_ignore:true}
	})
	,attributes:agile.delegate(agile._Component.prototype.attributes,{
		indeterminate:lang.mixin({},agile.BooleanMetadata,{label:"i18n_indeterminate"})
		,maximum:lang.mixin({},agile.NumberMetadata,{
			label:"i18n_maximum",
			onValueChange:function(widget,name,value){
				if(!widget.metadata("parameters.indeterminate")){//TODO:disable the editor if indeterminate is true 
					widget.delegate.set(name,value);
					widget.metadata("parameters."+name,value);
					widget.delegate.update();	
				}
			}
			,ignore:function(widget,sourcetype){
				return widget.metadata("parameters.indeterminate");
			}
		})
		,places:lang.mixin({},agile.NumberMetadata,{
			label:"i18n_precision"
			,onValueChange:function(widget,name,value){
				if(!widget.metadata("parameters.indeterminate")){
					widget.delegate.set(name,value);
					widget.metadata("parameters."+name,value);
					widget.delegate.update();	
				}
			}
			,ignore:function(widget,sourcetype){
				return widget.metadata("parameters.indeterminate");
			}
		})
		[#--,progress:lang.mixin({},agile.TextMetadata,{
			label:"i18n_progress"
			,onValueChange:function(widget,name,value){
				if(!widget.metadata("parameters.indeterminate")){
					widget.delegate.set(name,value);
					widget.metadata("parameters."+name,value);
					widget.delegate.set("progress",widget.delegate.metadata("parameters.progress"));
//					widget.delegate.update();	
				}
			}
			,ignore:function(widget,sourcetype){
				return widget.metadata("parameters.indeterminate");
			}
		})--]		
		,value:lang.mixin({},agile.NumberMetadata,{
			label:"i18n_value"
			,onValueChange:function(widget,name,value){
				if(!widget.metadata("parameters.indeterminate")){
					widget.delegate.set(name,value);
					widget.metadata("parameters."+name,value);
					widget.delegate.update();
				}
			}
			,ignore:function(widget,sourcetype){
				return widget.metadata("parameters.indeterminate");
			}
		})
		,label:lang.mixin({},agile.TextMetadata,{label:"i18n_label"})
		//,name:lang.mixin({},agile.TextMetadata,{label:"i18n_name"})
	})
	,initDefaultMetadata:function(){
		this.metadata("parameters.indeterminate",false);
		this.metadata("parameters.maximum",100);
		this.metadata("parameters.value",50);
		this.metadata("style.width","120px");
		agile.requireX("dijit.ProgressBar");
		this.metadata("dojoDeclaredClass","dijit.ProgressBar");
	}
	,init:function(){	
		if(!this.metadata("parameters.indeterminate")){
			this.delegate.set("maximum",this.metadata("parameters.maximum"));
			this.delegate.set("value",this.metadata("parameters.value"));
			if(this.metadata("parameters.places") != undefined){
				this.delegate.set("places",this.metadata("parameters.places"));
			}
		}
		
		if(this.metadata("parameters.label") != undefined){
			this.delegate.set("label",this.metadata("parameters.label"));
		}		
	}
	,getResizableTargetContainer:function(){			
		return this.delegate.domNode;
	}
[/@]			
